package com.hiultra.archive.controller;

import com.hiultra.archive.domain.ArcAlarm;
import com.hiultra.archive.service.IArcArchiveStatisticseService;
import com.hiultra.common.core.controller.BaseController;
import com.hiultra.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(tags="统计分析管理Controller")
@RestController
@RequestMapping("/archive/statisticse")
public class ArcArchiveStatisticseController extends BaseController {
    @Autowired
    private IArcArchiveStatisticseService iArcArchiveStatisticseService;
    /**
     * 档案分类数量统计
     **/
    @ApiOperation(value = "档案分类数量统计", notes = "档案分类数量统计")
    @GetMapping("/selectCatalogNum")
    public AjaxResult selectCatalogNum() {
        // 档案分类统计饼状图
        Map<String, Object> catalogMap = iArcArchiveStatisticseService.arcCatalogNumber();
        Map<String, Object> statisticsMap = new HashMap();
        statisticsMap.put("catalogMap", catalogMap);
        return AjaxResult.success(statisticsMap);
    }
    /**
     * 智能柜数量统计
     **/
    @ApiOperation(value = "智能柜数量统计", notes = "智能柜数量统计")
    @GetMapping("/selectCabinetNum")
    public AjaxResult selectCabinetNum() {
        // 库房数据
        Map<String, Object> cabinetMap = iArcArchiveStatisticseService.cabinetNumberMap();
        Map<String, Object> statisticsMap = new HashMap();
        statisticsMap.put("cabinetMap", cabinetMap);
        return AjaxResult.success(statisticsMap);
    }

    /**
     * 获取报警信息
     * @return
     */
    @ApiOperation(value = "报警信息", notes = "报警信息")
    @GetMapping("/selectBorrowOut")
    public AjaxResult getBorrowOut() {
        List<Map<String,ArcAlarm>>listhj = iArcArchiveStatisticseService.selectListDescLimit();
        return AjaxResult.success(listhj);
    }

    /**
     * 档案年增加数量和年利用率
     * @return
     */
    @ApiOperation(value = "档案年增加和年利用率", notes = "档案年增加和年利用率")
    @GetMapping("/selectAddNumberYear")
    public AjaxResult archiveAddNumberYear() {
        // 年新增档案
        Map<String, Object> map = iArcArchiveStatisticseService.archiveAddNumberYear();
        return AjaxResult.success(map);
    }

    /**
     * 档案月增加数量和月使用
     * @return
     */
    @ApiOperation(value = "档案月增加和月利用率", notes = "档案月增加和月利用率")
    @GetMapping("/selectAddNumberMouth")
    public AjaxResult archiveAddNumberMouth() {
        Map<String, Object> map = iArcArchiveStatisticseService.archiveAddNumberMouth();
        return AjaxResult.success(map);
    }

    /**
     * 查询首页数量
     **/
    @ApiOperation(value = "查询首页数量", notes = "查询首页数量")
    @GetMapping("/selectNum")
    public AjaxResult selectNum() {
        Map map = iArcArchiveStatisticseService.selectNum();
        return AjaxResult.success(map);
    }
}
